package com.lzw.breezeNovel.model.enums.novel;


/**
 * 广告状态
 */
@SuppressWarnings("all")
public enum AdvertisementStatus {
    PLAYING(0, "active"),
    PAUSE(1, "paused"),
    END(2, "ended");

    /**
     * 状态码
     */
    private Integer code;
    /**
     * 状态描述
     */
    private String desc;

    AdvertisementStatus(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;

    }

    /**
     * 根据状态码获取状态
     */
    public static AdvertisementStatus get(Integer code) {
        for (AdvertisementStatus status : AdvertisementStatus.values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("无效的状态码：" + code);
    }

}
